Public Class Diem
    'cac thuoc tinh
    Protected x As Double
    Protected y As Double
    'cac cau lenh property
    Property _x() As Double
        Get
            Return Me.x
        End Get
        Set(ByVal value As Double)
            Me.x = value
        End Set
    End Property
    Property _y() As Double
        Get
            Return Me.y
        End Get
        Set(ByVal value As Double)
            Me.y = value
        End Set
    End Property
    'ham khoi tao
    Public Sub New()
        Me.x = 0
        Me.y = 0
    End Sub
    'nhap
    Public Shared Function Nhap(ByVal ghichu As String) As Diem
        Dim p As New Diem
        Console.WriteLine(ghichu)
        Console.Write("nhap x: ")
        p.x = Double.Parse(Console.ReadLine())
        Console.Write("nhap y: ")
        p.y = Double.Parse(Console.ReadLine())
        Return p
    End Function
    'khoang cach
    Public Function KhoangCach(ByVal p As Diem) As Double
        Dim kq As Double
        kq = Math.Sqrt((Me.x - p.x) * (Me.x - p.x) + (Me.y - p.y) * (Me.y - p.y))
        Return kq
    End Function
End Class
